//返回上一页
$('#goBack').click(function() {
	history.go(-1);
});

//返回主页
$('#home').click(function() {

	location.href = 'index.html';

});


//上传头像的请求
$('form').submit(function (event) {
	event.preventDefault();
	//获取表单数据
	var data=new FormData(this);
	//contentType:false,
	//processData:false,必须
	$.post({
		url:'/user/photo',
		data:data,
		contentType:false,//必须
		processData:false,//必须
		success:function (resData) {
			$('.modal-body').text(resData.message);
			$('#myModal').modal('show').on('hide.bs.modal',function() {
				if(resData.code == 0) {
				location.href = '/';
			}
			});
		}
		
	})
	
});
